<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
    $(document).ready(function() {
        var contentNewHeight = $("#models").height() + $("#modelsParams").height();
        $("#content").css("height", contentNewHeight);

        $("#deviceTypes").change(function() {
            var selectedModel = $("#deviceTypes option:selected").val();
            if (selectedModel == "") {
                $("#modelsParams").html("");
                  $("#modelsParams").height(0);
                        //set new height to content
                            $("#content").css("height", $("#models").height() + $("#modelsParams").height()+150);
            } else {
                $.ajax({
                    url: "viewModelParams.action",
                    data:{
                        selectedModel:selectedModel
                    },
                    type:"post",
                    success:function(data) {
                          $("#modelsParams").height(500);
                        $("#modelsParams").html(data);
                        //set new height to content
                            $("#content").css("height", $("#models").height() + $("#modelsParams").height()+150);
                    }
                });
            }
        });

        $("#saveDefaults").live("click", function() {
            var model = $("#deviceTypes option:selected").val();

        });
    });
</script>
<style type="text/css">
    #modelsParams {
        width: 900px !important;
        margin-left: 30px;
        float: left;
        display: block;
        height: 0px;
    }

    #models {
        width: 200px;
        margin-left: 50px;
        float: left;
        height: 40px;
    }

</style>
<div style="margin-left: 340px;margin-top: 55px;margin-bottom: 30px;font-size: 20px;font-style: italic;">
    <s:text name="label.settingDefaultParam"/>
</div>
<div style="display: block; width: 750px;margin-top: 0px;">
    <div id="models">
        <s:text name="label.models"/>
        <s:select list="deviceModels" listKey="modelId" listValue="name" headerKey="" headerValue="--Select Models--"
                  id="deviceTypes" name="deviceModels"/>
    </div>
    <div>
        <s:if test="%{#session.actionMessage!=null}">
            <s:property value="#session.actionMessage"/>
        </s:if>
    </div>
    <div id="modelsParams"></div>
</div>
<input type="hidden" name="forSetDefParams">
